# 字典 根据键值查找value
# 字典的组成 key-value 键值对 map
# 定义一个字典
d = {"张三": 20, "李四": 19, "王五": 26}
# 通过key查找对应的value
print(d["张三"])
# 没有对应的键时
# print(d["田七"])
if "田七" in d:
    print(d["田七"])
else:
    print("没有田七这个键")
# Monday Tuesday Wednesday Thursday Friday Saturday Sunday
# 创建一个字典 只要输入前一个或者两个字母 就可以输出全部的单词
days = {"M": "Monday", "W": "Wednesday", "F": "Friday",
        "Tu": "Tuesday", "Th": "Thursday", "Sa": "Saturday", "Su": "Sunday",
        "T": ["Tuesday", "Thursday"], "S": ["Saturday", "Sunday"]}
words = input("请输入一个或者两个字母：")
if words not in days:
    print("没有该字母开头的单词")
else:
    day = days[words]
    print(day)
# 列表不能作为字典的键 key
# d1 = {[1,2,3]:"456"}
# print(d1)
# 元组作为键 元组是不可变类型
d1 = {(1,2):"456"}
print(d1)

